<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../css/goods/goods_list2.css" />
		<script type="text/javascript">
			(function() {
				var clientWidth = document.documentElement ? document.documentElement.clientWidth : document.body.clientWidth;
				clientWidth = clientWidth || localStorage.getItem("clientWidth")
				if(clientWidth > 750)
					clientWidth = 750;
				document.documentElement.style.fontSize = clientWidth * 1 / 16 + "px";
			})();
		</script>
		<style type="text/css">
			html,
			body {
				padding: 0;
				margin: 0;
			}
			.mingpin2_top_panel{
				padding: 0.6rem;
				/* background-color: #aaa; */
				overflow: hidden;
				background-color: #F1F1F1;
			}
			.mingpin2_top_panel_img{
				float: left;
				width:3.4rem;
				height: 3.4rem;
				overflow: hidden;
				border-radius: 50%;
				background-color: #fff;
				
			}
			.mingpin2_top_panel_img img{
				width: 100%;
				height: 100%;
			}
			.mingpin_top2_panel_info{
				float: left;
				/* background-color: #ccc; */
				width: 10rem;
				margin-left: 0.6rem;
			}
			.mingpin_top2_panel_title{
				
			}
			.mingpin_top2_panel_des{
				font-size: 0.5rem;
		 
				overflow: hidden;
			}
			.show_3_line{
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 3;
				overflow: hidden;
			}
			.mingpin_top_open{
				height: 1.2rem;
				/* background-color: #ccc; */
				float: left;
				width: 100%;
				margin-top: 1rem;
				text-align: center;
				font-size: 0.4rem;
				color: #AAAAAA;
			}
		</style>
	</head>

	<body>

		<div id="pullrefresh" class=" mui-scroll-wrapper" style=" ">
			<div class="mui-scroll">
				<!--数据列表-->
				<div class="mui-content" style="padding-top: 0;">
					
					<div class="mingpin2_top_panel">
						<div class="mingpin2_top_panel_img">
							<img :src="shop.pic" />
						</div>
						<div class="mingpin_top2_panel_info">
							<div class="mingpin_top2_panel_title">{{shop.name}}</div>
							<div :class="open_des_class2" v-html="shop.desc"></div>
						</div>
						<div class="mingpin_top_open" @tap="open_des">
							<i :class="open_des_class"></i>
							<span v-html="open_des_text">展开</span>
						</div>
					</div>
					
					
					
					<div class="goods_list">

						<div class="item" v-for="i in goods_list" @click="to_detail(i.goodsid)">
							<img :src="i.pic">
							<div class="title"><span class="spcile_price">
								<!-- <span>今日特价</span> -->
								</span> {{i.name}}</div>
							<div class="price">
								<span>￥{{i.min_price}}元</span>
								<!--<i><img src="../images/ptsp/car_03.png" alt=""></i>-->
							</div>
						</div>

					</div>

				</div>
			</div>
		</div>

		<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue.min.js"></script>
		<script src="../js/host.config.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/jquery.min.js"></script>
		<script src="../js/js.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var tab = new Vue({
				el: 'header',
				data: {

				},
				methods: {

				}
			});
			var shop = Storage.get("now_mingpin_shop_info");
			console.log(shop.sid)
			var app = new Vue({
				el: '.mui-content',
				data: {
					shop: '',
					goods_list: '',
					has_more_data: true,
					sq_info:'',
					is_open_des:false,
					open_des_text:'展开',
					open_des_class:'mui-icon mui-icon-arrowdown',
					open_des_height:'',
					open_des_class2:'mingpin_top2_panel_des show_3_line'
				},
				methods: {
					get_data: function(url, cb) {
						$.ajax({
							type: 'post',
							url: url,
							data: {
								sid:shop.sid,
								bid:this.sq_info.sqid
							},
							success: function(res) {

								if(typeof res == 'string') {
									res = JSON.parse(res)
								}
								console.log(res);
								if(res.code == 1) {
									cb(res)
								}
							},
							error: function() {

							}
						})
						// mui.ajax(host_config.host + url, {

						// 	dataType: 'json', //服务器返回json格式数据
						// 	type: 'get', //HTTP请求类型
						// 	timeout: 10000, //超时时间设置为10秒；

						// 	success: function(res) {
						// 		//服务器返回响应，根据响应结果，分析是否登录成功；
						// 		console.log(res);
						// 		if(res.code == 200) {
						// 			cb(res)
						// 		}
						// 	},
						// 	error: function(xhr, type, errorThrown) {
						// 		//异常处理；
						// 		console.log(type);
						// 	}
						// });
					},
					get_more_data: function() {
						// var that = this;
						// if(this.has_more_data) {
						// 	this.get_data("/sim_data.search-group-list.json", function(res) {

						// 		var new_data = that.search-group-list.concat(res.data);
						// 		that.search-group-list = new_data;
						// 		//如果是最后一页数据,则将 has_more_data 改为false
						// 		that.has_more_data = false;
						// 	})
						// }
					},
					to_detail: function(goods_id) {
					 
						mui.openWindow('goods_detail.html?goodsid=' + goods_id, 'goods_detail.html')
					},
					open_des:function(){
						console.log(1)
						if(!this.is_open_des){
							this.open_des_text = '收起';
							this.open_des_class = 'mui-icon mui-icon-arrowup'
							this.is_open_des = !this.is_open_des;
							this.open_des_class2 = 'mingpin_top2_panel_des'
							
							
						}else{
							this.open_des_text = '展开';
							this.open_des_class = 'mui-icon mui-icon-arrowdown'
							this.is_open_des = !this.is_open_des;
							this.open_des_class2 = 'mingpin_top2_panel_des show_3_line'
							 
						}
					}
				},
				mounted: function() {
					var that = this;
					var sq_info = localStorage.getItem("address");
					if(sq_info){
						sq_info = JSON.parse(sq_info);
						this.sq_info = sq_info;
					}
					this.get_data("https://zhapp.4hl.cn/api/seller/get_goods", function(res) {
						that.goods_list = res.data;
						tap_init();
					})
					var shop = localStorage.getItem("now_mingpin_shop_info");
					if(shop) {
						shop = JSON.parse(shop)
						this.shop = shop
					}
					// 初始化页面
					mui.init({
						pullRefresh: {
							container: '#pullrefresh',
							down: {
								callback: pulldownRefresh
							},
							up: {
								contentrefresh: '正在加载...',
								callback: pullupRefresh
							}
						}
					});
				}
			})

			function tap_init() {
				function click() {
					this.click();
				}

				mui(".goods_list").on('tap', '.item', click)

			}

			function pulldownRefresh() {
				setTimeout(function() {

					// 	app.get_data("/sim_data.search-group-list.json", function(res) {

					// 		app.search-group-list = res.data;
					// 	})
					// 	app.has_more_data = true;
					// 	//获取数据成功过后将 列表重新渲染，完成后执行
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //刷新完成
				}, 1000);
			}

			function pullupRefresh() {
				// setTimeout(function() {
				// 	// 调用vue实例中的获取更多数据
				// 	app.get_more_data();
				// 	//如果 has_more_data 为false 则表示没有数据了 则调用endPullupToRefresh
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); //参数为true代表没有更多数据了。

				// }, 1000);
			}
		</script>
	</body>

</html>